﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Password : Form
    {
        public Password()
        {
            InitializeComponent();
        }

        private bool contraseña()
        {
            int nCuenta = 0;
            Password password = new Password();
            if (TxtPassword.Text.Length != 0 && TxtPassword.Text.CompareTo("ABRIL") == 0)
            {
                nCuenta += 1;
            }
            else

                if (TxtPassword.Text.Length != 0 && TxtPassword.Text.CompareTo("ABRIL") != 0)
                {
                    MessageBox.Show("El Password no es correcto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtPassword.Clear();
                    TxtPassword.Focus();
                    nCuenta = 3;
                }
            if (nCuenta == 1)
                return true;
            return false;
        }



        private void BtIngresar_Click(object sender, EventArgs e)
        {
            MDIMenu MDIMenu = new MDIMenu();
            Password Password = new Password();
            if (!contraseña())
            {
                MessageBox.Show("El programa finalizara", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            else
                MessageBox.Show("Bienvenido al Software");
            this.Hide();
            MDIMenu.Show();
            Password.Close();
        }

        private void BtCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}